using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class so_ticket_invoicesMap : EntityTypeConfiguration<so_ticket_invoices>
    {
        public so_ticket_invoicesMap()
        {
            // Primary Key
            this.HasKey(t => new { t.Invoice__, t.Currency, t.doctype, t.Date });

            // Properties
            this.Property(t => t.Invoice__)
                .IsRequired()
                .HasMaxLength(8);

            this.Property(t => t.Customer__)
                .HasMaxLength(6);

            this.Property(t => t.Customer_Name)
                .HasMaxLength(110);

            this.Property(t => t.Currency)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.doctype)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.vglbatch)
                .HasMaxLength(10);

            // Table & Column Mappings
            this.ToTable("so_ticket_invoices");
            this.Property(t => t.Invoice__).HasColumnName("Invoice_#");
            this.Property(t => t.Customer__).HasColumnName("Customer_#");
            this.Property(t => t.Customer_Name).HasColumnName("Customer_Name");
            this.Property(t => t.Currency).HasColumnName("Currency");
            this.Property(t => t.doctype).HasColumnName("doctype");
            this.Property(t => t.Document__).HasColumnName("Document_#");
            this.Property(t => t.Date).HasColumnName("Date");
            this.Property(t => t.Total).HasColumnName("Total");
            this.Property(t => t.Closed).HasColumnName("Closed");
            this.Property(t => t.Notes).HasColumnName("Notes");
            this.Property(t => t.vglbatch).HasColumnName("vglbatch");
        }
    }
}
